package com.red.mybatisFirst;

import org.apache.ibatis.session.SqlSession;

import com.red.mybatisFirst.mapper.RoleMapper;
import com.red.mybatisFirst.po.Role;
import com.red.mybatisFirst.util.SqlSessionFactoryUtil;

public class Chapter2Main {

	public static void main(String[] args) {
		SqlSession sqlSession = null;
		try {
			sqlSession=SqlSessionFactoryUtil.openSqlSession();
			RoleMapper roleMapper=sqlSession.getMapper(RoleMapper.class);
			
			System.out.println("role:--->"+roleMapper.getRole(1l));
			sqlSession.commit();
		} catch (Exception e) {
			e.printStackTrace();
			sqlSession.rollback();
		}finally {
			if(sqlSession!=null) {
				sqlSession.close();
			}
		}
		
	}

}
